import { EntitySchema } from '@mikro-orm/core';
import { OfficeNews } from './OfficeNews';
import { OfficePosts } from './OfficePosts';

export class OfficeNewsPostsPivots {
  id!: string;
  news!: OfficeNews;
  post!: OfficePosts;
}

export const OfficeNewsPostsPivotsSchema = new EntitySchema({
  class: OfficeNewsPostsPivots,
  properties: {
    id: { primary: true, type: 'string', columnType: 'bigint' },
    news: { primary: true, reference: 'm:1', entity: () => OfficeNews, index: 'news_id' },
    post: { primary: true, reference: 'm:1', entity: () => OfficePosts, index: 'post_id' },
  },
});
